<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

    
    

    <style>
        .father{
            background: lightseagreen;
        }
        /* 清除浮动的最佳实践, 最为推荐 */
        .clearfix::after{
            content: "";
            display: block;
            clear: both;
        }
        .son{
            /* overflow: hidden; */
        }
        p{
            padding: 2px;
            background: darkorchid;
            margin-left: 5px;
            float: left;
        }
    </style>

    <h1>清除浮动的最佳实践, 最为推荐</h1>
    <div class="father">
        <div class="son clearfix">
            <p>1111111</p>
            <p>1111111</p>
            <p>1111111</p>
            <p>1111111</p>
            <p>1111111</p>
            <p>1111111</p>
            <p>1111111</p>
            <p>1111111</p>
            <p>1111111</p>
            <p>1111111</p>
            <p>1111111</p>
        </div>
    </div>


    <pre>
        <h1>
            /* 清除浮动的最佳实践, 最为推荐 */
            .clearfix::after{
                content: "";
                display: block;
                clear: both;
            }
    
        </h1>
    </pre>
</body>
</html>